<?php
/**
 * gpa_demo Description
 * @package 
 * @name evalid
 * @filesource e-valid.php
 * @author Meta Sanjaya
 */

$token = escape($_GET['token']);
$username = escape($_GET['username']);
$row = $db->query("SELECT user_id FROM #_users WHERE `username`='$username'")->rows;

if(count($row)) {
    $uid = $row[0]['user_id'];
    $check = $db->query("SELECT COUNT(*) AS jumlah FROM #_users_validation WHERE user_id='$uid' AND token='$token'");
    if(count($check)) {
        $db->query("DELETE FROM #_users_validation WHERE user_id='$uid");
        $db->query("UPDATE #_users SET active='1' WHERE user_id='$uid'");

        include_once 'validation-success.html.php';
    } else {
        include_once 'validation-failed-no-token.html.php';
    }
} else {
    include_once 'validation-failed-no-username.html.php';
}



?>
